Fix key-chord problem
authorjustbur <justin@burkett.cc>
Thu, 31 Mar 2016 20:13:06 +0000 (16:13 -0400)
committerjustbur <justin@burkett.cc>
Thu, 31 Mar 2016 20:13:06 +0000 (16:13 -0400)
See the note in which-key--update

which-key.el

index 2706a99062b97e8be706a56b0196205843b823c5..8435d2eb2ecd9ba205396b42797083585e3226d4 100644 (file)
@@ -2028,8 +2028,13 @@ Finally, show the buffer."
             (condition-case nil
                 (let ((rkeys (recent-keys)))
                   (vector 'key-chord
-                          (aref rkeys (- (length rkeys) 2))
-                          (aref rkeys (- (length rkeys) 1))))
+                          ;; Take the two preceding the last one, because the
+                          ;; read-event call in key-chord seems to add a
+                          ;; spurious key press to this list. Note this is
+                          ;; different from guide-key's method which didn't work
+                          ;; for me.
+                          (aref rkeys (- (length rkeys) 3))
+                          (aref rkeys (- (length rkeys) 2))))
               (error (progn
                        (message "which-key error in key-chord handling")
                        [key-chord])))))